package com.gopay.common.cps.dao.acct.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.acct.PayNuccChannelDAO;
import com.gopay.common.domain.bank.route.po.pay.PayNuccChannel;
/**
 * 网联通道出款DAO实现
 *
 * @author lynn
 * @data
 */
@Repository("payNuccChannelDAO")
public class PayNuccChannelDAOImpl extends BaseDAOImpl<PayNuccChannel, String> implements PayNuccChannelDAO {

	@Override
	public void update(PayNuccChannel payNuccChannel){
		super.update(payNuccChannel);
	}

	@Override
	public List<PayNuccChannel> findPayNuccChannelByType(String type) {
		String hql = "from PayNuccChannel where type = :type";
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("type", type);
		
		List<PayNuccChannel> payNuccChannels = this.findByHql(hql, param);
		return payNuccChannels;
	}

	@Override
	public PayNuccChannel findPayNuccChannelByRecBankCode(String recBankCode) {
		String hql = "from PayNuccChannel where recBankCode = :recBankCode";
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("recBankCode", recBankCode);
		List<PayNuccChannel> payNuccChannels = this.findByHql(hql, param);
		if(null != payNuccChannels && payNuccChannels.size()>0){
			return payNuccChannels.get(0);
		}else{
			return null;
		}
		
	}

}
